import { cuisines } from "./cuisines";
import fetch from "../api/request";

import * as types from "./types";

const request = <T>(param: T) => {
    return () => {
        return new Promise<T>((s, j) => {
            setTimeout(() => {
                s(param);
            }, 0);
        });
    };
};

export default {
    cuisines: async (type: string) => {
        return request(cuisines[type])();
    },

    getCuisine: async (name: string): Promise<types.IObjectKeys> => {
        return fetch.get("getCuisine", {
            name,
        });

    },

    getJSONFile: async (name: string) => {
        return fetch.get("getJSONFile", {
            name,
        });
    },
};

export type { types };
